

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>类别修改</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="/static/admin/layuiadmin/layui/css/layui.css" media="all">
</head>
<body>
  <!-- 判断是否添加顶级 -->

  <div class="layui-form" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-form-useradmin" style="padding: 20px;">
    <form>

          <div class="layui-form-item">
              <label class="layui-form-label">类别名称</label>
              <div class="layui-input-block">
                <input type="text" name="typename" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input" value="{$data['typename'] ? $data['typename'] :''}">
              </div>
            </div>
    
          
          <div class="layui-form-item">
            <label class="layui-form-label">排序</label>
            <div class="layui-input-block">
              <input type="number" name="sort" autocomplete="off" class="layui-input"  value="{$data.sort}">
            </div>
          </div>
          <div class="layui-form-item" lay-filter="sex">
            <label class="layui-form-label">状态</label>
            <div class="layui-input-block">
              <input type="radio" name="status" value="1" title="启用" {php}if($data['status']==1){echo 'checked';}else{echo '';}{/php}>
              <input type="radio" name="status" value="2" title="禁用" {php}if($data['status']==2){echo 'checked';}else{echo '';}{/php}>
            </div>
          </div>
          <div class="layui-form-item" lay-filter="sex">
            <label class="layui-form-label">是否热门</label>
            <div class="layui-input-block">
              <input type="radio" name="hot" value="1" title="否" {php}if($data['hot']==1){echo 'checked';}else{echo '';}{/php}>
              <input type="radio" name="hot" value="2" title="是" {php}if($data['hot']==2){echo 'checked';}else{echo '';}{/php}>
            </div>
          </div>
    
    <div class="layui-form-item layui-hide">
        <input type="button" lay-submit lay-filter="LAY-user-front-submit" id="LAY-user-front-submit" value="确认">
    </div>
  </form>
  </div>
  <script src="/static/admin/layuiadmin/layui/layui.js"></script>  
  <script>
  layui.config({
    base: '/static/admin/layuiadmin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'form', 'upload'], function(){
    var $ = layui.$
    ,form = layui.form
    ,upload = layui.upload ;
    
    upload.render({
        elem: '#upload'
        ,url: "{:url('/admin/type/upload')}"
        ,auto: true //选择文件后自动上传
        // ,bindAction: '#LAY-user-front-submit'
        ,field:'image'
        ,accept: 'images'   //指定允许上传时校验的文件类型
        ,method: 'post'
        ,acceptMime: 'image/*'
        ,multiple: false  
        ,done: function(res){  //执行上传请求后的回调。返回三个参数
          $('#img').val(res.data)
          $('#demo').attr('src', res.data); //图片链接（base64）
          layer.msg('上传成功', {
                    offset: '15px'
                    ,icon: 1
                    ,time: 1000
                  });
        },error:function(res){

        }
      });
    upload.render({
        elem: '#upload1'
        ,url: "{:url('/admin/type/upload')}"
        ,auto: true //选择文件后自动上传
        // ,bindAction: '#LAY-user-front-submit'
        ,field:'image'
        ,accept: 'images'   //指定允许上传时校验的文件类型
        ,method: 'post'
        ,acceptMime: 'image/*'
        ,multiple: false  
        ,done: function(res){  //执行上传请求后的回调。返回三个参数
          $('#img1').val(res.data)
          $('#demo1').attr('src', res.data); //图片链接（base64）
          layer.msg('上传成功', {
                    offset: '15px'
                    ,icon: 1
                    ,time: 1000
                  });
        },error:function(res){

        }
      });
    //   //监听提交
    // form.on('submit(LAY-user-front-submit)', function(data){
    //   layer.msg(JSON.stringify(data.field));
    //   console.log(data.field);
    //   return false;
    // });
  })
  </script>
     <!-- 编辑器调用;必须包在<form>里面才能获取到富文本内容 -->

<script type="text/javascript" charset="utf-8" src="/static/admin/ueditor/ueditor.config.js"></script>

<script type="text/javascript" charset="utf-8" src="/static/admin/ueditor/ueditor.all.js"></script>

<script type="text/javascript" charset="utf-8" src="/static/admin/ueditor/lang/zh-cn/zh-cn.js"></script>

<script type="text/javascript">

    // var ue = UE.getEditor('content',{ zIndex: 10});

        var ue = UE.getEditor('desc',{ zIndex: 10});



</script>
</body>
</html>